<?php include_once('includes/header.php'); ?>
<?php include_once('includes/posts-header.php'); ?>
<?php include_once('scripts/session.php'); ?>
<?php include_once('scripts/get-categories.php'); ?>
<?php include_once('scripts/get-posts.php'); ?>
<?php 
	$mess = '';
	$mess_class = '';
	if (isset($_SESSION['message']) && $_SESSION['message'] !== '') {
		$mess = $_SESSION['message'];
		$mess_class = 'success';
		$_SESSION['message'] = '';
	}
?>
		<script type="text/javascript" src="js/manage-posts.js"></script>
		<div class="col-full">
			<form name="posts" action="posts.php" id="posts"></form>
				<div id="toolbar" class="floatright">
					<ul>
						<li><a href="create-posts.php" class="toolbar" id="new"><span class="new"></span>New</a></li>
						<li><a href="#" class="toolbar" id="edit" onclick="editpost();"><span class="edit"></span>Edit</a></li>
						<li><a href="#" class="toolbar" id="publish" onclick="update_posts_state(this);"><span class="publish"></span>Publish</a></li>
						<li><a href="#" class="toolbar" id="unpublish" onclick="update_posts_state(this);"><span class="unpublish"></span>Unpublish</a></li>
						<li><a href="#" class="toolbar" id="trash" onclick="update_posts_state(this);"><span class="trash"></span>Trash</a></li>
					</ul>
				</div><!-- End #toolbar-->
				<div id="error-message" class="<?php echo $mess_class; ?>"><?php echo $mess; ?></div>
				<div id="postsmenu" class="data-menu">
					<ul>
						<li><?php create_categories_list("categoryid",$cat_id);?></li>
						<li>
							<select name="state" id="state" onchange="changeConditions();">
								<option value="0">- Select state -</option>
								<option value="1">Publish</option>
								<option value="2">Unpublish</option>
								<option value="3">Trash</option>
							</select>
						</li>
						<li>
							<select name="author" id="author" onchange="changeConditions();">
								<option value="all">- Select authors -</option>
								<option value="admin">Admin</option>
							</select>
						</li>
					</ul>
				</div><!-- End #postsmenu-->
				<div id="viewposts" class="data">
					<?php get_posts(1,10); ?>
				</div><!-- End #viewposts-->
			</form>
		</div><!-- End .col-full-->
	</div><!-- End #mainWrapper-->
</body>
</html>